 const api = require("../../../utils/api")
 const getwxphone = require("../../../utils/getwxphone")
 Page({

   /**
    * 页面的初始数据
    */
   data: {
     list: [{
         title: '思考在前-国考修行手册',
         fm: 'https://sd.offcn.com/zg/wximg/2022/gsk/fbook/6.png',
         lists: [{
             name: '国考博闻强“识”',
             sid: 0
           },
           {
             name: '国考向未来',
             sid: 1
           },
           {
             name: '国考招警',
             sid: 2
           },
           {
             name: '银保监会备考手册',
             sid: 3
           },
           {
             name: '证监会备考手册',
             sid: 4
           }
         ]
       },
       {
         title: '并行不悖-行测概论思维导图',
         fm: 'https://sd.offcn.com/zg/wximg/2022/gsk/fbook/4.png',
         lists: [{
           name: '并行不悖-行测概论思维导图',
           sid: 5
         }]
       },
       {
         title: '梦笔生花-文采优化200组',
         fm: 'https://sd.offcn.com/zg/wximg/2022/gsk/fbook/5.png',
         lists: [{
           name: '梦笔生花-文采优化200组',
           sid: 6
         }]
       },
       {
         title: '熟能生巧-技巧点拨36计',
         fm: 'https://sd.offcn.com/zg/wximg/2022/gsk/fbook/1.png',
         lists: [{
           name: '熟能生巧-技巧点拨36计',
           sid: 7
         }]
       },
       {
         title: '心中有方-时评精读20篇',
         fm: 'https://sd.offcn.com/zg/wximg/2022/gsk/fbook/2.png',
         lists: [{
           name: '心中有方-时评精读20篇',
           sid: 8
         }]
       },
       {
         title: '川不辞盈-国考常识300问',
         fm: 'https://sd.offcn.com/zg/wximg/2022/gsk/fbook/3.png',
         lists: [{
           name: '川不辞盈-国考常识300问',
           sid: 9
         }]
       },




     ]
   },
   topdf(e) {
     var _ = this;
 
     var phone = wx.getStorageSync('51164phone')
     if (phone) {
       console.log(e.currentTarget.dataset.sid)
       var sid = e.currentTarget.dataset.sid;
       wx.navigateTo({
         url: '../pdf/pdf?sid=' + sid,
       })
     } else {
       wx.showToast({
         title: '请先登录',
         icon: 'none',
         duration: 2000
       });
       _.setData({
         login: 1
       })
     }
   },
   zixun(e) {
     var _ = this;
     wx.navigateTo({
       url: '../zixun/zixun',
     })
   },
   close(e) {
     var _ = this;
     _.setData({
       login: !1
     })
   },
   getPhoneNumber(e) {
     var _ = this;
     var flag = _.data.flag;
     const info = {
       area: wx.getStorageSync('area'),
       agent: wx.getStorageSync('agent'),
       page: wx.getStorageSync('page'),
       activeId: 42
     }
     if (flag) {
       getwxphone(e.detail.code, 51164, 'biaodan', info)
         .then(res => {
           console.log(res);
           _.setData({
             login: !1
           })
         })
         .catch(err => {
           console.log(err);
         })
     } else {
       wx.showToast({
         title: '请先勾选隐私协议！',
         icon: 'none'
       })
     }
   },
   xz: function (e) {
     var _ = this;
     var flag = e.detail.value[0];
     if (flag == undefined) {
       flag = false
     } else {
       flag = true
     }
     _.setData({
       flag
     })
     console.log(_.data.flag)
   },
   xy: function (e) {
     var _ = this;
     wx.navigateTo({
       url: '../../agreement/agreement',
     })
   },

   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
     api.load(options)
    //  wx.setStorageSync('51164phone', '15205451183')
   },

   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {

   },

   /**
    * 生命周期函数--监听页面显示
    */
   onShow: function () {

   },

   /**
    * 生命周期函数--监听页面隐藏
    */
   onHide: function () {

   },

   /**
    * 生命周期函数--监听页面卸载
    */
   onUnload: function () {

   },

   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh: function () {

   },

   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {

   },

   /**
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {

   }
 })